# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=bolt
pkgver=0.9.6
pkgrel=1
pkgdesc="Thunderbolt 3 device manager"
url="https://gitlab.freedesktop.org/bolt/bolt"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	asciidoc
	bash
	eudev-dev
	glib-dev
	meson
	polkit-dev
	"
checkdepends="
	dbus
	py3-gobject3
	"
subpackages="$pkgname-doc"
source="https://gitlab.freedesktop.org/bolt/bolt/-/archive/$pkgver/bolt-$pkgver.tar.gz"

# tests hit a udf instruction, due to some test_notify_teardown pointer free
# being undefined. using a different allocator fixes it, so musl is being
# strict about the UB tests here, but the issue is not from the code itself
options="$options !check"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dman=true \
		-Dsystemd=false \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
c8d638fa9eb73c79cb4ee93c8c29d7d71d0ae449b2363bc75c303f978201078a42d4b05095e67d677447aea1db9d337f195ce264175c6b0c4733e9ed3eb2e081  bolt-0.9.6.tar.gz
"
